﻿/*
 * @Autor: PK
 * @Date: 2021/12/12 19:09:SS
 */

using System;
using ShkSimulation.core.dao.output.result;
using ShkSimulation.core.dao.statistic;
using ShkSimulation.core.dao.statistic.feature;

namespace ShkSimulation.core.dao.output {

	public class ConsoleResultShower : ResultShower{
		
		public void Show(Result result) {
			Console.WriteLine("Key:" + result.Uniquekey);
			Console.WriteLine(@"Data:");
			var data = result.TakeOutputData();
			foreach (var (variableAndeHourStatisticKey, statisticInfo) in data.FlatData) {
				foreach (var keyValuePair in statisticInfo) {
					Console.WriteLine($@"{variableAndeHourStatisticKey}:{keyValuePair.ToString()}");
				}
			}
			foreach ((string key, CollectionReportData collectionReportData) in data) {
				Console.WriteLine(key);
				foreach ((VariableAndHourStatisticKey uniqueKey, StatisticInfo statisticInfo) in collectionReportData) {
					Console.WriteLine($"  -{uniqueKey}:");
					foreach (var (statistic, value) in statisticInfo) {
						Console.WriteLine($@"    [{statistic}: {value}]");
					}
				}
			}
		}
		
	}
}